package com.core.controller.Admin;


import com.core.pojo.Result.PageResult;
import com.core.pojo.Result.Result;
import com.core.pojo.SeatReservation.entity.Reservation;
import com.core.service.Admin.AdminService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin")
@Tag(name = "管理员模块")
@RequiredArgsConstructor
public class AdminController {

    private final AdminService adminService;

    @Operation(summary = "获取所有用户预约记录（分页）")
    @GetMapping("/reservation/allHistory")
    public Result<PageResult<Reservation>> queryAllReservations(@RequestParam(defaultValue = "1") int page,
                                                                @RequestParam(defaultValue = "10") int pageSize){
        return adminService.queryAllReservations(page,pageSize);
    }

    @Operation(summary = "获取单个用户预约记录（分页）")
    @GetMapping("/reservation/UserHistory")
    public Result<PageResult<Reservation>> queryUserReservations(@RequestParam(defaultValue = "1") int page,
                                                                @RequestParam(defaultValue = "10") int pageSize,
                                                                 @RequestParam Long userId){
        return adminService.queryUserReservations(page,pageSize,userId);
    }

}
